﻿using Shop.RemoteModel.SpecTemplate;
using Shop.RemoteModel.SpecTemplate.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class SpecTemplateEvent : IRpcApiService
    {
        private readonly ISpecsTemplateService _Service;

        public SpecTemplateEvent (ISpecsTemplateService service)
        {
            this._Service = service;
        }
        public Dictionary<long, int> SetSpecTemplateSort (SetSpecTemplateSort obj)
        {
            return this._Service.SetSort(obj.Id, obj.Sort);
        }
        public long AddSpecTemplate (AddSpecTemplate add)
        {
            return this._Service.Add(add.Datum);
        }
        public bool SetSpecTemplate (SetSpecTemplate obj)
        {
            return this._Service.Set(obj.Id, obj.Datum);
        }
        public void DeleteSpecTemplate (DeleteSpecTemplate obj)
        {
            this._Service.Delete(obj.Id);
        }
        public SpecTemplateDto GetSpecTemplate (GetSpecTemplate obj)
        {
            return this._Service.Get(obj.Id);
        }
        public void SetSpecTemplateIsEnable (SetSpecTemplateIsEnable obj)
        {
            this._Service.SetIsEnable(obj.Id, obj.IsEnable);
        }
        public SpecTemplateDto[] GetSpecTemplates (GetSpecTemplates obj)
        {
            return this._Service.Gets(obj.TemplateId);
        }
        public SpecTemplateItem[] GetSpecTemplateItem (GetSpecTemplateItem obj)
        {
            return this._Service.GetItems(obj.TemplateId, obj.QueryKey);
        }
    }
}
